/* 
 * File:   Mod_IO.h
 * Author: dechow
 *
 * Created on 27. März 2012, 10:13
 */

#ifndef MOD_IO_H
#define	MOD_IO_H

//#ifdef	__cplusplus
//extern "C" {
//#endif
    using namespace std;
    class Mod_out
    {
        public:
         Mod_out(tempmap <string,double> *tempgrid);
         ~Mod_out()
         {;}
        //1. fluxes
        tempmap  <string,double> fluxes;
        //2. states
         map < string, timepointmap < double > > states;
        //3. fluxes within soil
        map <string,tempmap <int,double> > field_of_fluxes;
        //4. states within soil
        map < string, map < int, timepointmap < double > > > field_of_states;
        int plot();
    };
    class Mod_in
    {
        public:
            tempmap <string,double> *tempgrid;
            vector <int> *horizons;
            string root;
	
	

	
	Mod_in(
		tempmap <string,double> *itempgrid,
                vector <int> *ihorizons,
		string iroot)
		{
		tempgrid=itempgrid;
        horizons=ihorizons;
		root=iroot;
		
		}
        Mod_in(
		tempmap <string,double> *itempgrid,
		string iroot)
		{
			tempgrid=itempgrid;
			root=iroot;
		
		}
	     Mod_in(vector <int> *ihorizons,
		string iroot)
		{
           horizons=ihorizons;
		   root=iroot;
		}
    };
    class Mod_out_handling
    {
    protected:    
   
    virtual int compute (time_intervall &ti)=0;    
    public: 
        Mod_out *out;
        Mod_in *inp;
        Mod_out_handling(Mod_in *iinp);
        ~Mod_out_handling();
        double get_fluxes(string varname,time_intervall &ti);
        double get_fluxes(string identifier,int horizon,time_intervall &ti);
        int set_push_back_fluxes(string key,time_intervall &ti, double wert);
        int set_push_back_fluxes(string identifier,int key, time_intervall &ti, double wert);
        double get_states (string key,timestamp &ti);
        double get_states ( string identifier, int key,timestamp &ti);
        int set_states(string key,timestamp &ts,double wert);
        int set_states(string  identifier, int key,timestamp &ts,double wert);
        int compute_loop (time_intervall &ti);
        int compute_loop (timestamp &ts);
        int define_field_of_states(string identifier,int nkey);
        int define_field_of_fluxes(string identifier,int nkey);
        double get_dx(int layer);
    };


//#ifdef	__cplusplus

#endif

//#endif	/* MOD_IO_H */

